<script>


    $(document).ready(function() {
        
        
        jQuery("#formulario").validate({
            submitHandler: function(form) {
                jQuery(form).ajaxSubmit({
                    target: "#explotacion"
                });
            }
        });  }
        
)
        
</script>
<div id="explotacion">
    <fieldset> 

        <?php echo $this->Form->create("ExploitationType", array("id" => "formulario", "action" => "edit/" . $this->data['ExploitationType']['id'])); ?>
        <?php echo $this->Form->hidden('ExploitationType.property_id'); ?>
        <?php echo $this->Form->hidden('ExploitationType.id'); ?>
        <?php echo $this->Form->input('ExploitationType.tipo', array('label' => 'Tipo', 'class' => '', 'empty' => '', 'options' => array('Agrícola' => 'Agrícola', 'Pecuaria' => 'Pecuaria', 'Forestal' => 'Forestal'))); ?>

        <?php
        echo $this->Ajax->observeField('ExploitationTypeTipo', array(
            'url' => array('action' => 'select'),
            'frequency' => 0.2,
            'update' => 'tipo',
            'indicator' => 'load'
                )
        );
        ?>

        <div id="tipo">

            <?php if ($this->data['ExploitationType']['tipo'] == "Agrícola"): ?>
                <?php echo $this->Form->input('ExploitationType.tipo_agricola', array('label' => '', 'class' => '', 'empty' => '', 'options' => array('Solo' => 'Solo', 'Asociado' => 'Asociado'))); ?>

                <?php echo $this->Form->input('ExploitationType.cultivo', array('label' => 'Cultivo/variedad', 'class' => '')); ?>


            <?php endif; ?>
            <?php if ($this->data['ExploitationType']['tipo'] == "Pecuaria"): ?>
                <?php echo $this->Form->input('ExploitationType.tipo_pecuario', array('label' => '', 'class' => '', 'empty' => '', 'options' => array('Bovinos' => 'Bovinos', 'Piscicultura' => 'Piscicultura', 'Especies Menores' => 'Especies Menores'))); ?>

            <?php endif; ?>
            <?php if ($this->data['ExploitationType']['tipo'] == "Forestal"): ?>

            <?php endif; ?>



        </div>
        <?php echo $this->Form->input('ExploitationType.area', array('label' => 'Área (ha)', 'class' => '')); ?>

        <?php echo $this->Form->end("Guardar") ?>
    </fieldset> 
</div>
